<?php


namespace App\Admin\Services\Wechat;


use App\Repositories\Wechat\MiniProgramDraftToTemplateRecordRepository;

class MiniProgramDraftRecordService {
    private $_repository;

    public function __construct(MiniProgramDraftToTemplateRecordRepository $repository) {
        $this->_repository = $repository;
    }

    /**
     * 代码草稿日志列表
     *
     * @return mixed
     */
    public function page() {
        $draftRecordRes = $this->_repository->queryByConditionAndPage(
            function ($query) {
                $query->with(['user']);
            }
        );
        foreach ($draftRecordRes['list'] as $key => &$val) {
            $draftRecordRes['list'][$key]['user_name'] = $val->User->name;
        }
        return $draftRecordRes;
    }
}